/// 设备列表 - 数据格式
class TangeEqKeyData {
  List<TangeEqData>? keyList;
  int? total;

  TangeEqKeyData.fromJson(dynamic json) {
    keyList = [];
    total = json['total']; // 提取 total 值

    if (json['list'] is List) {
      for (var element in json['list']) {
        keyList?.add(TangeEqData.fromJson(element));
      }
    }
  }

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['list'] = keyList?.map((e) => e.toJson()).toList();
    map['total'] = total;
    return map;
  }
}

class TangeEqData {
  TangeEqData({
    this.id,
    this.deviceId,
    this.deviceName,
    this.productKey,
    this.isOwner,
    this.coverImage,
    this.type,
    this.state,
    this.nightVisionMode
  });

  TangeEqData.fromJson(dynamic json) {
    id = json['id'];
    deviceId = json['deviceId'];
    deviceName = json['deviceName'];
    productKey = json['productKey'];
    coverImage = json['coverImage'];
    isOwner = json['isOwner'];
    type = json['type'];
    state = json['state'];
    nightVisionMode = json['nightVisionMode'];
  }

  int? id; // 添加的主键 id
  String? deviceId;
  String? deviceName;
  String? productKey;
  String? coverImage;
  bool? isOwner;
  int? type;
  int? state;
  String? nightVisionMode;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['id'] = id; // 在 toJson 中添加 id
    map['deviceId'] = deviceId;
    map['deviceName'] = deviceName;
    map['productKey'] = productKey;
    map['isOwner'] = isOwner;
    map['state'] = state;
    map['nightVisionMode'] = nightVisionMode;
    return map;
  }
}